/* 选择完成度 */
export const tabControlMixin = {
  data () {
    return {
      iid: 0,/* 学生id */
      title: null,
    };
  },
  mounted () { },
  methods: {
    // 判断是否完成
    initChange () {
      const tag = document.querySelectorAll(".tag-icon");
      const status = document.querySelectorAll(".status");

      /* 考试初始化 */
      for (let i = 0; i < this.examList.length; i++) {
        if (status[i].innerHTML == '已完成' && tag[i].classList.contains('exam')) {
          tag[i].classList.add("exam_ok")
        }
      }

      /* 作业初始化 */
      for (let i = 0; i < this.workList.length; i++) {
        if (status[i].innerHTML == '已完成' && tag[i].classList.contains('work')) {
          tag[i].classList.add("work_ok")
        }
      }
    },

    // 选项选择（暂时未开启）
    cleItemClick (index) {
      var topicList = document.querySelectorAll('.item')
      var status = document.querySelectorAll('.status')

      switch (index) {
        case 0:
          this.workList = this.processList;
          break;
        case 1:
          this.processList = [];
          for (const item of this.processList) {
            console.log(item.status);
            if (item.status == 1) {
              /* 已完成 */
              this.processList.push(item);
            }
          }
          this.workList = this.processList;
          break;
        case 2:
          for (const item of this.processList) {
            if (item.status == 0) {
              /* 未完成 */
              this.processList.push(item);
            }
          }
          this.workList = this.processList;
          break;
      }
    }
  }
};

/* 选项选择 */
export const topicSelect = {
  data () {
    return {
      radioIndex: []
    };
  },
  created () {
    this.radioIndex = [];
    for (let i = 0; i < this.judgeTopic.length; i++) {
      var item = { flag: "" };
      this.radioIndex.push(item);
    }
    console.log(this.radioIndex);
  },
  methods: {
    selectClick (index, cIndex) {
      console.log(index, cIndex);
      this.radioIndex[cIndex].flag = index;
    }
  }
};
